﻿
--Suppression des clés des traductions en double

DELETE FROM dbo.Localizations
WHERE pk IN(
SELECT max(pk)
  FROM [dbo].[Localizations]
  group by ResourceId,LocaleId,ResourceSet
  having count(*)>1
  )
  
  
  -- Suppression des pages ImportNodes.aspx et ExportNodes.aspx
  
  
delete from medianamik_NodePropertyValue where NodeId = 'FF35561B-BB5B-4E48-99C8-FBC9A45118BB'
delete from medianamik_NodeInstance where NodeId ='FF35561B-BB5B-4E48-99C8-FBC9A45118BB'
delete from medianamik_Node where nodeid = 'FF35561B-BB5B-4E48-99C8-FBC9A45118BB'


delete from medianamik_NodePropertyValue where NodeId = 'E91497E9-5B73-401D-A1D7-DD4E1662C490'
delete from medianamik_NodeInstance where NodeId ='E91497E9-5B73-401D-A1D7-DD4E1662C490'
delete from medianamik_Node where nodeid = 'E91497E9-5B73-401D-A1D7-DD4E1662C490'


-- Ajout de la Page Default.aspx dans ImportExportManagement

IF NOT EXISTS( SELECT NULL  FROM medianamik_Node where NodeId = '96DD8DA9-550E-459E-AF4F-F008A38EDD4C')  BEGIN  INSERT INTO [dbo].[medianamik_Node]             ([NodeId]             ,[ParentNodeId]             ,[ContentNodeId]             ,[TypeId]             ,[CreatedOn]             ,[CreatedBy]             ,[ModifiedOn]             ,[ModifiedBy]             ,[Flags]             ,[IsDeleted]             ,[Path]             ,[Depth]             ,[Position]             ,[Roles])       VALUES             ('96DD8DA9-550E-459E-AF4F-F008A38EDD4C'             ,'7A6A4803-1D66-40F5-8DAB-76AFDAE93CF0'             ,NULL             ,'3DAD4D08-B9BC-4603-A8DE-42A88A354B5B'             ,'2008-12-15 09:02:12.770'             ,'sa'             ,'2008-12-15 09:02:12.770'             ,'sa'             ,         0             ,         0             ,'.7A6A4803-1D66-40F5-8DAB-76AFDAE93CF0.96DD8DA9-550E-459E-AF4F-F008A38EDD4C.'             ,         1             ,         0             ,'')  END

IF NOT EXISTS(SELECT NULL FROM Medianamik_NodeInstance WHERE NodeId = '96DD8DA9-550E-459E-AF4F-F008A38EDD4C' AND CultureNAme = 'en-CA')  BEGIN  INSERT INTO [dbo].[medianamik_NodeInstance]             ([NodeInstanceId]             ,[NodeId]             ,[IsActive]             ,[CreatedOn]             ,[CreatedBy]             ,[ModifiedOn]             ,[ModifiedBy]             ,[CultureName])       VALUES             ('4F9141A3-DA92-4A8E-AC14-0A15B65DF25B'             ,'96DD8DA9-550E-459E-AF4F-F008A38EDD4C'             ,         1             ,'2008-12-15 09:02:12.770'             ,'sa'             ,'2008-12-15 09:02:12.770'             ,'sa'             ,'en-CA')  END
IF NOT EXISTS(SELECT NULL FROM Medianamik_NodeInstance WHERE NodeId = '96DD8DA9-550E-459E-AF4F-F008A38EDD4C' AND CultureNAme = 'fr-CA')  BEGIN  INSERT INTO [dbo].[medianamik_NodeInstance]             ([NodeInstanceId]             ,[NodeId]             ,[IsActive]             ,[CreatedOn]             ,[CreatedBy]             ,[ModifiedOn]             ,[ModifiedBy]             ,[CultureName])       VALUES             ('15AAC6FB-164B-4667-9776-D5D2D4CC499B'             ,'96DD8DA9-550E-459E-AF4F-F008A38EDD4C'             ,         1             ,'2008-12-15 09:02:12.770'             ,'sa'             ,'2008-12-15 09:02:12.770'             ,'sa'             ,'fr-CA')  END

IF NOT EXISTS( SELECT NULL FROM medianamik_NodePropertyValue where NodeId = '96DD8DA9-550E-459E-AF4F-F008A38EDD4C' AND PropertyId = '7213C44C-BBC7-4095-AE52-0DE37E7276C7' AND CultureName = '' AND Revision IS NULL)  BEGIN  INSERT INTO [dbo].[medianamik_NodePropertyValue]             ([NodePropertyValueId]             ,[NodeId]             ,[PropertyId]             ,[Value]             ,[IsApproved]             ,[IsDeleted]             ,[Revision]             ,[CultureName]             ,[CreatedOn]             ,[CreatedBy]             ,[ModifiedOn]             ,[ModifiedBy]             )       VALUES             (NEWID()             ,'96DD8DA9-550E-459E-AF4F-F008A38EDD4C'             ,'7213C44C-BBC7-4095-AE52-0DE37E7276C7'             ,'False'             ,         0             ,         0             ,null             ,''             ,'2008-12-15 09:02:12.770'             ,'sa'             ,'2008-12-15 09:02:12.770'             ,'sa'             )  END
IF NOT EXISTS( SELECT NULL FROM medianamik_NodePropertyValue where NodeId = '96DD8DA9-550E-459E-AF4F-F008A38EDD4C' AND PropertyId = '47096ACE-4C51-4C8F-BAE2-15A6FD90F6E9' AND CultureName = '' AND Revision IS NULL)  BEGIN  INSERT INTO [dbo].[medianamik_NodePropertyValue]             ([NodePropertyValueId]             ,[NodeId]             ,[PropertyId]             ,[Value]             ,[IsApproved]             ,[IsDeleted]             ,[Revision]             ,[CultureName]             ,[CreatedOn]             ,[CreatedBy]             ,[ModifiedOn]             ,[ModifiedBy]             )       VALUES             (NEWID()             ,'96DD8DA9-550E-459E-AF4F-F008A38EDD4C'             ,'47096ACE-4C51-4C8F-BAE2-15A6FD90F6E9'             ,'/default.aspx'             ,         0             ,         0             ,null             ,''             ,'2008-12-15 09:02:12.770'             ,'sa'             ,'2008-12-15 09:02:12.770'             ,'sa'             )  END
IF NOT EXISTS( SELECT NULL FROM medianamik_NodePropertyValue where NodeId = '96DD8DA9-550E-459E-AF4F-F008A38EDD4C' AND PropertyId = '18232ABC-5DD8-4AE5-947A-16F3AF3A8715' AND CultureName = 'en-CA' AND Revision IS NULL)  BEGIN  INSERT INTO [dbo].[medianamik_NodePropertyValue]             ([NodePropertyValueId]             ,[NodeId]             ,[PropertyId]             ,[Value]             ,[IsApproved]             ,[IsDeleted]             ,[Revision]             ,[CultureName]             ,[CreatedOn]             ,[CreatedBy]             ,[ModifiedOn]             ,[ModifiedBy]             )       VALUES             (NEWID()             ,'96DD8DA9-550E-459E-AF4F-F008A38EDD4C'             ,'18232ABC-5DD8-4AE5-947A-16F3AF3A8715'             ,'Import & Export'             ,         0             ,         0             ,null             ,'en-CA'             ,'2008-12-15 09:02:12.770'             ,'sa'             ,'2008-12-15 09:02:12.770'             ,'sa'             )  END
IF NOT EXISTS( SELECT NULL FROM medianamik_NodePropertyValue where NodeId = '96DD8DA9-550E-459E-AF4F-F008A38EDD4C' AND PropertyId = '18232ABC-5DD8-4AE5-947A-16F3AF3A8715' AND CultureName = 'fr-CA' AND Revision IS NULL)  BEGIN  INSERT INTO [dbo].[medianamik_NodePropertyValue]             ([NodePropertyValueId]             ,[NodeId]             ,[PropertyId]             ,[Value]             ,[IsApproved]             ,[IsDeleted]             ,[Revision]             ,[CultureName]             ,[CreatedOn]             ,[CreatedBy]             ,[ModifiedOn]             ,[ModifiedBy]             )       VALUES             (NEWID()             ,'96DD8DA9-550E-459E-AF4F-F008A38EDD4C'             ,'18232ABC-5DD8-4AE5-947A-16F3AF3A8715'             ,'Importatons et exportations'             ,         0             ,         0             ,null             ,'fr-CA'             ,'2008-12-15 09:02:12.770'             ,'sa'             ,'2008-12-15 09:02:12.770'             ,'sa'             )  END
IF NOT EXISTS( SELECT NULL FROM medianamik_NodePropertyValue where NodeId = '96DD8DA9-550E-459E-AF4F-F008A38EDD4C' AND PropertyId = '60C0AA24-C355-4722-ACAA-21D363351479' AND CultureName = '' AND Revision IS NULL)  BEGIN  INSERT INTO [dbo].[medianamik_NodePropertyValue]             ([NodePropertyValueId]             ,[NodeId]             ,[PropertyId]             ,[Value]             ,[IsApproved]             ,[IsDeleted]             ,[Revision]             ,[CultureName]             ,[CreatedOn]             ,[CreatedBy]             ,[ModifiedOn]             ,[ModifiedBy]             )       VALUES             (NEWID()             ,'96DD8DA9-550E-459E-AF4F-F008A38EDD4C'             ,'60C0AA24-C355-4722-ACAA-21D363351479'             ,'eede521a-746e-4943-843e-80f54d884824'             ,         0             ,         0             ,null             ,''             ,'2008-12-15 09:02:12.770'             ,'sa'             ,'2008-12-15 09:24:52.867'             ,'sa'             )  END
IF NOT EXISTS( SELECT NULL FROM medianamik_NodePropertyValue where NodeId = '96DD8DA9-550E-459E-AF4F-F008A38EDD4C' AND PropertyId = 'A5F1D87F-3086-4CEA-A983-A09D4FE9FC4C' AND CultureName = '' AND Revision IS NULL)  BEGIN  INSERT INTO [dbo].[medianamik_NodePropertyValue]             ([NodePropertyValueId]             ,[NodeId]             ,[PropertyId]             ,[Value]             ,[IsApproved]             ,[IsDeleted]             ,[Revision]             ,[CultureName]             ,[CreatedOn]             ,[CreatedBy]             ,[ModifiedOn]             ,[ModifiedBy]             )       VALUES             (NEWID()             ,'96DD8DA9-550E-459E-AF4F-F008A38EDD4C'             ,'A5F1D87F-3086-4CEA-A983-A09D4FE9FC4C'             ,'46c11abf-a1e3-4d61-a46d-660a677ae5dc'             ,         0             ,         0             ,null             ,''             ,'2008-12-15 09:02:12.770'             ,'sa'             ,'2008-12-15 09:02:12.770'             ,'sa'             )  END
IF NOT EXISTS( SELECT NULL FROM medianamik_NodePropertyValue where NodeId = '96DD8DA9-550E-459E-AF4F-F008A38EDD4C' AND PropertyId = 'A9D96D60-4E0D-4EF6-831C-AAD02A1D2BCF' AND CultureName = '' AND Revision IS NULL)  BEGIN  INSERT INTO [dbo].[medianamik_NodePropertyValue]             ([NodePropertyValueId]             ,[NodeId]             ,[PropertyId]             ,[Value]             ,[IsApproved]             ,[IsDeleted]             ,[Revision]             ,[CultureName]             ,[CreatedOn]             ,[CreatedBy]             ,[ModifiedOn]             ,[ModifiedBy]             )       VALUES             (NEWID()             ,'96DD8DA9-550E-459E-AF4F-F008A38EDD4C'             ,'A9D96D60-4E0D-4EF6-831C-AAD02A1D2BCF'             ,'True'             ,         0             ,         0             ,null             ,''             ,'2008-12-15 09:02:12.770'             ,'sa'             ,'2008-12-15 09:02:12.770'             ,'sa'             )  END
IF NOT EXISTS( SELECT NULL FROM medianamik_NodePropertyValue where NodeId = '96DD8DA9-550E-459E-AF4F-F008A38EDD4C' AND PropertyId = '29571C7C-3B7A-4576-8BB0-F2EAF8413D20' AND CultureName = '' AND Revision IS NULL)  BEGIN  INSERT INTO [dbo].[medianamik_NodePropertyValue]             ([NodePropertyValueId]             ,[NodeId]             ,[PropertyId]             ,[Value]             ,[IsApproved]             ,[IsDeleted]             ,[Revision]             ,[CultureName]             ,[CreatedOn]             ,[CreatedBy]             ,[ModifiedOn]             ,[ModifiedBy]             )       VALUES             (NEWID()             ,'96DD8DA9-550E-459E-AF4F-F008A38EDD4C'             ,'29571C7C-3B7A-4576-8BB0-F2EAF8413D20'             ,'True'             ,         0             ,         0             ,null             ,''             ,'2008-12-15 09:02:12.770'             ,'sa'             ,'2008-12-15 09:24:52.867'             ,'sa'             )  END